/*
 * Tic-Tac-Toe - Turn-based strategy game
 * Copyright 2008, 2009 Shayne Riley and Paul Maseberg
 *
 * Tic-Tac-Toe is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Tic-Tac-Toe is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tic-Tac-Toe.  If not, see <http://www.gnu.org/licenses/>
 * or write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * To contact the authors on questions or issues regarding the license,
 * you may send an email to <shayner at gmail dot com>
 */

#include "MenuButton.h"

MenuButton::MenuButton(Graphics *gfx, std::string text, int leftX, int lowerY,
        int width, int height)
: Button(leftX, lowerY, width, height), mGfx(gfx), mText(text)
{
}

MenuButton::~MenuButton()
{
}

void MenuButton::draw()
{

    if (isHovering())
    {
        mGfx->setThickness(2);

        mGfx->setColor(0.1f, 0.1f, 0, 0.85f);
        mGfx->drawRectFill(mLeftX, mLowerY, mWidth, mHeight);

        mGfx->setColor(0.5f, 0.5f, 1, 1);
        mGfx->drawRect(mLeftX, mLowerY, mWidth, mHeight);

        mGfx->setColor(1, 1, 1);
    }
    else if (isPressing())
    {
        mGfx->setThickness(2);

        mGfx->setColor(0.1f, 0.1f, 0, 0.85f);
        mGfx->drawRectFill(mLeftX, mLowerY, mWidth, mHeight);

        mGfx->setColor(1, 0, 0, 1);
        mGfx->drawRect(mLeftX, mLowerY, mWidth, mHeight);

        mGfx->setColor(1, 1, 1);
    }
    else
    {
        mGfx->setThickness(1);

        mGfx->setColor(0.1f, 0.1f, 0, 0.75f);
        mGfx->drawRectFill(mLeftX, mLowerY, mWidth, mHeight);

        mGfx->setColor(0, 0, 1, 1);
        mGfx->drawRect(mLeftX, mLowerY, mWidth, mHeight);

        mGfx->setColor(0.9f, 0.9f, 0.9f);
    }

    mGfx->setFontSize(20);
    mGfx->drawText(mText.c_str(), mLeftX, mLowerY, mWidth, mHeight);
}
